From 3a58a8ea42ce3a5571533482d6e6f3e61347aaff Mon Sep 17 00:00:00 2001 From: robertl Date: Thu, 6 Aug 2009 19:55:30 +0000 Subject: [PATCH] Read and write fix information in delgpl format. --- delgpl.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/delgpl.c b/delgpl.c index 544a476e0..a30b7d5b6 100644 --- a/delgpl.c +++ b/delgpl.c @@ -71,6 +71,13 @@ gpl_read(void) if (wpt_tmp->altitude <= unknown_alt + 1) wpt_tmp->altitude = unknown_alt; wpt_tmp->creation_time = le_read32(&gp.tm); + + switch (le_read32(&gp.status)) { + case 1: wpt_tmp->fix = fix_none; break; + case 2: wpt_tmp->fix = fix_2d; break; + case 3: wpt_tmp->fix = fix_3d; break; + case 5: wpt_tmp->fix = fix_dgps; break; + } WAYPT_SET(wpt_tmp, course, le_read_double(&gp.heading)); WAYPT_SET(wpt_tmp, speed, le_read_double(&gp.speed)); @@ -112,6 +119,14 @@ gpl_trackpt(const waypoint *wpt) gpl_point_t gp; double speed = 3600*METERS_TO_MILES(wpt->speed); double heading = wpt->course; + + switch(wpt->fix) { + case fix_none: status = 1; break; + case fix_2d: status = 2; break; + case fix_3d: status = 3; break; + case fix_dgps: status = 5; break; + default: status = 3; // a strategic lie for fix_unknown. + } memset(&gp, 0, sizeof(gp)); le_write32(&gp.status, status); -- 2.30.2